@extends('mobile.layouts.default')
@section('title', '编辑历史充值号码')

@section('content')
    <nav class="nav navbar-light w-100">
        <div class="container d-flex flex-row justify-content-between align-items-center">
            <div class="back-ico mr-2">
                <a class="fas fa-chevron-left" href="{{ route('recharge.index') }}"></a>
            </div>
            <div class="nav-title position-absolute w-100 text-center">
                <span>编辑历史充值号码</span>
            </div>
        </div>
    </nav>

    <div class="recharge-history-inner container ajax-inner" data-load="0">
        @if(count($user_num_histories))
        @include('mobile.layouts._recharge-history-item', ["user_num_histories" => $user_num_histories])
        @else
        <div class="mt-5 container text-center">
            <p>您还没有充值过任何号码</p>
        </div>
        @endif
    </div>

    @include('mobile.layouts._wait_for_post')

    @include('mobile.layouts.footer')

    @include('mobile.layouts._ajax_load')

@stop

@push('page-css')
    <link rel="stylesheet" type="text/css" href="/assets/mobile/css/recharge.css">
@endpush

@push('page-js')
    <script src="/assets/mobile/js/ajax_load.js"></script>
    <script charset="utf-8">
        $('.delete-history').click(function() {
            $('#waitForPost').modal('show');
            $.ajax({
                url: "{{ route('recharge.history.delete') }}",
                type: "POST",
                data: {
                    "delete_id" : $(this).attr('data-id'),
                },
                complete:function(error) {
                    if (error['status']  === 500) {
                        $('#waitForPost').modal('hide');
                        layer.open({
                            content: '服务器未响应，请稍后再试'
                            ,skin: 'msg'
                            ,time: 3 //2秒后自动关闭
                        });
                    }
                },
                success:function(data){
                    $('#waitForPost').modal('hide');
                    location.reload();
                }
            })
        })
    </script>
@endpush
